<html>

<script>

var urls = [];

function parseUrl(url){
	
	if(url != null && url.indexOf('/') > 0){
		
		var s = url.split('/');
		
		url = url.replace(s[s.length-1], "");
		
	}
	return url;
}

function queryUrl(url, callback){
	if(urls[parseUrl(url)] != null)
		callback(true);
}

function addUrl(url){
	if(url != null && urls[parseUrl(url)] == null){
		urls[parseUrl(url)] = true;
	}
}

function delUrl(url){
	if(url != null && urls[parseUrl(url)] == true){
		urls[parseUrl(url)] = null;
	}
}

function onRequest(request, sender, callback) {
  if (request.action == 'queryUrl') {
    queryUrl(request.url, callback);
  }
	if (request.action == 'addUrl') {
    addUrl(request.url);
  }
	if (request.action == 'delUrl') {
    delUrl(request.url);
  }
}

chrome.extension.onRequest.addListener(onRequest);

</script>


</html>